import Taro, { Component } from '@tarojs/taro'
import { Image } from '@tarojs/components'
import classNames from 'classnames'
import { headImg } from '@/utils/utils'
import styles from './index.module.scss'
import {FyImg} from "@/components/index";

export default class Index extends Component {
  props: any

  static options = {
    addGlobalClass: true
  }

  render() {
    const prefixCls = 'goods-img'
    const {
      src,
      info={},
      mode,
      size,
      lazyLoad=false,
      className,
    } = this.props
    return (<FyImg src={src ? src : headImg(info.images)} mode={mode} lazyLoad={lazyLoad} className={classNames(styles[prefixCls], className, {
      // [styles[`${prefixCls}--saled`]]: !info.stockNumber,
      [styles[`${prefixCls}--end`]]: !info.isOnSale,
      [styles[`${prefixCls}--${size}`]]: size
    })}/>)
  }
}
